﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RegisterUser
{
    public partial class WebFormRegister : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //this.ButtonRegister.Enabled = false;
        }

        protected void checkBoxAccept_CheckedChanged(object sender, EventArgs e)
        {
            //if (IsPostBack)
            //{               
            //    this.ButtonRegister.Enabled = this.CheckBoxAccept.Checked;                
            //}            
        }

        protected void ButtonRegister_Click(object sender, EventArgs e)
        {
            //this.CheckBoxAccept.Checked = false;
            Page.Validate("AddressInfo");
            Page.Validate("LogIn");
            Page.Validate("PersonalInfo");
        }

        protected void RadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
        {

            if (this.RadioButtonList.SelectedItem.Text == "male")
            {
                AddCars();
            }
            else
            {
                AddCoffees();
            }
        }

        protected void AddCoffees()
        {
            this.Panel.Controls.Clear();
            DropDownList dropDown = new DropDownList();
            dropDown.Items.Add("New Brasil");
            dropDown.Items.Add("Dau Egbourts");
            dropDown.Items.Add("Elite");
            this.Panel.Controls.Add(dropDown);            
        }

        protected void AddCars()
        {
            this.Panel.Controls.Clear();
            CheckBox checkBox = new CheckBox();
            checkBox.Text = "Toyota";
            this.Panel.Controls.Add(checkBox);
            checkBox = new CheckBox();
            checkBox.Text = "BMW";
            this.Panel.Controls.Add(checkBox);
            checkBox = new CheckBox();
            checkBox.Text = "Mercedes";
            this.Panel.Controls.Add(checkBox);
            checkBox = new CheckBox();
            checkBox.Text = "Opel";
            this.Panel.Controls.Add(checkBox);
        }
    }
}